<?php

class BoletoController extends Controller {

    const PACKAGE_VIEW = 'boleto';

    /**
     * @var BoletoService
     */
    private $boletoService;
    /**
     * @var ClienteService
     */
    private $clienteService;
    /**
     * @var FinanceiroService
     */
    private $financeiroService;
    /**
     * @var LancamentoService
     */
    private $lancamentoService;

    public function __construct() {
        $this->boletoService = BoletoService::getInstance();
        $this->clienteService = ClienteService::getInstance();
        $this->financeiroService = FinanceiroService::getInstance();
        $this->lancamentoService = LancamentoService::getInstance();
    }

    public function listarClientes() {

        $this->save(SESSION_INTERFACE, 'CustomerList', $this->clienteService->findWithBilletPayment());
        $this->view('listar_clientes', self::PACKAGE_VIEW);
    }

    public function listarPendencias() {
        $IDFinanceiro = treatUrl('id');
        multipleEntities($IDFinanceiro);
        $this->save(SESSION_INTERFACE, 'PendingPaymentList', $this->financeiroService->findPendingPaymentsByFinancial($IDFinanceiro));
        $this->view('listar_pendencias', self::PACKAGE_VIEW);
    }

    public function codigoBarra(){
        new BarCode('125689365472365458',0,'hello.gif', 500, 130, true);
    }

    public function visualizarBoleto(){
        $IDCobranca = treatUrl('id');
        multipleEntities($IDCobranca);
        $this->save(SESSION_INTERFACE, 'Billet', $this->boletoService->findBilletByRelease($IDCobranca));
        $this->view('visualizar_boleto', self::PACKAGE_VIEW, true);
    }

}

?>
